package com.walker.handler;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

	/**
	 * 静态文件都是放在static文件夹下面的,但是访问这些静态资源的时候在url中是不会通过/static请求 
	 * 而是直接通过/css或者是/js访问因此需要做的就是将这些拦截排除掉和/static没有关系
	 */
    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(new ResponseResultInterceptor())
                .addPathPatterns("/**")
        		.excludePathPatterns("/css/**","/fonts/**","/img/**","/js/**","/media/**","/t-sources/**","/third/**","/*.html","/*.js");
    }
    
    /**
     **解决ctrl返回字符串类型转换异常问题
     * ctrl返回值全部改造完才能使用
     */
    /*
    @Override
    public void configureMessageConverters(List<HttpMessageConverter<?>> converters) {
        converters.add(0, new MappingJackson2HttpMessageConverter());
    }*/
}